import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import fire from '@dfeidao/atom-web/msg/fire';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import hide from '@dfeidao/atom-web/ui/hide';

export default async function a004(fd: IFeidaoAiBrowserComponent, e: Event) {
	// todo
	const n = e.currentTarget as HTMLDivElement;
	const no = n.getAttribute('data-no');
	// 考试名称:
	const res = await nodejs<{ dt: Array<{ exam_name: string }> }>('employee-examination/zj-000001/s007',
		{
			filter: {
				exam_id: no
			}
		});
	// 总分 试卷编号
	const res1 = await nodejs<{ dt: Array<{ exam_score: number, paper_number: string }> }>('employee-examination/zj-000001/s008',
		{
			filter: {
				exam_id: no
			}
		});
	const exam_name = res.dt[0].exam_name;
	const exam_score = res1.dt[0].exam_score;
	const paper_number = res1.dt[0].paper_number;

	hide(fd.data.node);
	fire('zj-000004', 'a001', paper_number, exam_score, exam_name);

}
